package server;
import persistencia.Persistencia;
import java.sql.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author unascribed
 * @version 1.0
 */

public class Control {
  protected Persistencia persistencia = null;
  protected boolean debug = false;
  protected Connection conexionSQL = null;

  public Control() {
  }
  public Connection getConexionSQL() {
    return conexionSQL;
  }
  public void setConexionSQL(Connection conexionSQL) {
    this.conexionSQL = conexionSQL;
  }

  public ResultSet ejecutarSQL(String sql)
  {

// assume that conn is an already created JDBC connection
      Statement stmt = null;
      ResultSet rs = null;

      try {
        stmt = conexionSQL.createStatement();
        rs = stmt.executeQuery(sql);

        // Now do something with the ResultSet ....
        return rs;
      } catch (Exception ex)
      {
        // it is a good idea to release
        // resources in a finally{} block
        // in reverse-order of their creation
        // if they are no-longer needed
        ex.printStackTrace();
        return null;
      }
  }


}